home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 3.iso / dist / fw_mc.idb / usr / freeware / lib32 / mc / cedit.menu.z / cedit.menu
Text File  |  2002-07-08  |  12KB  |  457 lines

  1. shell_patterns=0    # expression type
  2.  
  3. # The macros are:
  4. #
  5. # %c The cursor column position number. For edit menu only.
  6. # %i The indent of blank space, equal the cursor column 
  7. #    position. For edit menu only.
  8. # %y The syntax type of current file. For edit menu only.
  9. # %b The block file name.
  10. # %e The error file name.
  11. # %f The current file name.
  12. # %n Only the current file name without extension.
  13. # %x The extension of current file name.
  14. # %d The current directory name.
  15. # %F The current file in the unselected panel.
  16. # %D The directory name of the unselected panel.
  17. # %t The currently tagged files.
  18. # %T The tagged files in the unselected panel.
  19. # %u and %U Similar to the %t and %T macros, but in
  20. #    addition the files are untagged. You can use this macro
  21. #    only once per menu file entry or extension file entry,
  22. #    because next time there will be no tagged files.
  23. # %s and %S The selected files: The tagged files if
  24. #    there are any. Otherwise the current file.
  25. # %% The % character
  26. #
  27. # %{some text} Prompt for the substitution. An input box
  28. #    is shown and the text inside the braces is used as a
  29. #    prompt. The macro is substituted by the text typed by the
  30. #    user. The user can press ESC or F10 to cancel. This macro
  31. #    doesn't work on the command line yet.
  32.  
  33. #----------------------- Begin [perl] language template -----------------------
  34. + y Perl\ Program | f \.pl$
  35. 1       Author description header
  36.         unset LANG
  37.         AUTHOR="$(cat /etc/passwd |grep ^$(id -un) |awk -F: '{print($5)}')"
  38.         cat >>%b <<EOF
  39.         #----------------------------------------------------------------------
  40.         # Description:
  41.         # Author: $AUTHOR <$(echo -ne $REPLYTO)>
  42.         # Created at: $(date)
  43.         # Computer: $(uname -n) 
  44.         # System: $(uname -sr) on $(uname -m)
  45.         #    
  46.         # Copyright (c) $(date +%%Y) $AUTHOR  All rights reserved.
  47.         #
  48.         #----------------------------------------------------------------------
  49.         # Configure section:
  50.         
  51.         #----------------------------------------------------------------------
  52.         #
  53.         # main()
  54.         
  55.         EOF
  56.  
  57. + y Perl\ Program | f \.pl$
  58. 2       while ()
  59.         cat <<EOF > %b
  60.         %iwhile() {
  61.         %i}
  62.         EOF
  63.  
  64. + y Perl\ Program | f \.pl$
  65. 3       for ()
  66.         cat <<EOF > %b
  67.         %ifor ($i =  ; $i <  ; $i++) {
  68.         %i}
  69.         EOF
  70.  
  71. + y Perl\ Program | f \.pl$
  72. 4       foreach ()
  73.         cat <<EOF > %b
  74.         %iforeach ($ ) {
  75.         %i}
  76.         EOF
  77.  
  78. + y Perl\ Program | f \.pl$
  79. 5       if ()
  80.         cat <<EOF > %b
  81.         %iif () {
  82.         %i}
  83.         EOF
  84.                 
  85. + y Perl\ Program | f \.pl$
  86. 6       if () else
  87.         cat <<EOF > %b
  88.         %iif () {
  89.         %i} else {
  90.         %i}
  91.         EOF
  92.  
  93. + y Perl\ Program | f \.pl$
  94. 7       if () elsif ()
  95.         cat <<EOF > %b
  96.         %iif () {
  97.         %i} elsif () {
  98.         %i}
  99.         EOF
  100.  
  101. + y Perl\ Program | f \.pl$
  102. 8       substr ()
  103.         echo "%i$ = substr(\$str, \$off, \$cnt);" >%b
  104.  
  105. + y Perl\ Program | f \.pl$
  106. 9       opendir ()
  107.         cat <<EOF > %b
  108.         %iopendir(DIR, \$dir) || die("\$0: can't open \$dir\n");
  109.         EOF
  110.  
  111. + y Perl\ Program | f \.pl$
  112. a       sub ()
  113.         NAME=%{ Enter name of subroutine: }
  114.         cat <<EOF > %b
  115.         sub
  116.         $NAME ()
  117.         {
  118.         } # end of $NAME()        
  119.         EOF
  120. #----------------------- End [perl] language template -------------------------
  121.  
  122. #---------------------- Begin [shell] language template -----------------------
  123. + y Shell\ Script | f \.sh$
  124. 1       Author description header
  125.         unset LANG
  126.         AUTHOR="$(cat /etc/passwd |grep ^$(id -un) |awk -F: '{print($5)}')"
  127.         cat >>%b <<EOF
  128.         #----------------------------------------------------------------------
  129.         # Description:
  130.         # Author: $AUTHOR <$(echo -ne $REPLYTO)>
  131.         # Created at: $(date)
  132.         # Computer: $(uname -n) 
  133.         # System: $(uname -sr) on $(uname -m)
  134.         #    
  135.         # Copyright (c) $(date +%%Y) $AUTHOR  All rights reserved.
  136.         #
  137.         #----------------------------------------------------------------------
  138.         # Configure section:
  139.         
  140.         #----------------------------------------------------------------------
  141.         #
  142.         # main()
  143.         
  144.         EOF
  145.  
  146. + y Shell\ Script | f \.sh$
  147. 3       for
  148.         cat <<EOF > %b
  149.         %ifor i in \$
  150.         %ido
  151.         %idone
  152.         EOF
  153.  
  154. + y Shell\ Script | f \.sh$
  155. 4       while
  156.         cat <<EOF > %b
  157.         %iwhile
  158.         %ido
  159.         %idone
  160.         EOF
  161.  
  162. + y Shell\ Script | f \.sh$
  163. 5       if [] then else
  164.         cat <<EOF >> %b
  165.         %iif [ ];then
  166.         %ielse
  167.         %ifi
  168.         EOF
  169.  
  170. + y Shell\ Script | f \.sh$
  171. 6       case
  172.         NUMBER=%{ Enter number elements of case:}
  173.         cat <<EOF > %b
  174.         %icase "\$" in
  175.         EOF
  176.         while [ "$NUMBER" -gt 0 ]
  177.         do
  178.         cat <<EOF >> %b
  179.         %i)
  180.     %i    ;;
  181.         EOF
  182.         let NUMBER=$NUMBER-1    
  183.         done
  184.         cat <<EOF >> %b
  185.         %i*)
  186.         %iesac
  187.         EOF
  188.  
  189. + y Shell\ Script | f \.sh$
  190. 7       function
  191.         NAME=%{ Enter name of function:}
  192.         cat <<EOF >> %b
  193.         $NAME() {
  194.         } # end of $NAME()
  195.         EOF
  196.                 
  197. + y Shell\ Script | f \.sh$
  198. 8       select of bash
  199.         cat <<EOF >> %b
  200.         %iselect i in \$l
  201.         %ido
  202.         %i    if [ -n "\$i" ];then
  203.     %i       break
  204.         %i    else
  205.     %i       continue
  206.         %i    fi    
  207.         %idone
  208.         EOF
  209.         
  210. #----------------------- End [shell] language template ------------------------
  211.  
  212. #------------------------- Begin [c] language template ------------------------
  213. + f \.h$ | f \.c$ | f \.cc$
  214. 1       Author description header
  215.         unset LANG
  216.         AUTHOR="$(cat /etc/passwd |grep ^$(id -un) |awk -F: '{print($5)}')"
  217.         cat >> %b <<EOF
  218.         /********************************************************************
  219.         * Description:
  220.         * Author: $AUTHOR <$(echo -ne $REPLYTO)>
  221.         * Created at: $(date)
  222.         * Computer: $(uname -n) 
  223.         * System: $(uname -sr) on $(uname -m)
  224.         *    
  225.         * Copyright (c) $(date +%%Y) $AUTHOR  All rights reserved.
  226.         *
  227.         ********************************************************************/
  228.         EOF
  229.  
  230. + f \.h$ | f \.c$ | f \.cc$
  231. 2       GPL description header
  232.         cat >>%b <<EOF
  233.         /*
  234.         * This program is free software; you can redistribute it and/or modify
  235.         * it under the terms of the GNU General Public License as published by
  236.         * the Free Software Foundation; either version 2 of the License, or
  237.         * (at your option) any later version.
  238.         *
  239.         * This program is distributed in the hope that it will be useful,
  240.         * but WITHOUT ANY WARRANTY; without even the implied warranty of
  241.         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  242.         * GNU General Public License for more details.
  243.         *
  244.         * You should have received a copy of the GNU General Public License
  245.         * along with this program; if not, write to the Free Software
  246.         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  247.         */
  248.         EOF
  249.  
  250. + f \.c$ | f \.cc$
  251. 3       if ()
  252.         cat <<EOF > %b
  253.         %iif () {
  254.         %i}
  255.         EOF
  256.                 
  257. + f \.c$ | f \.cc$
  258. 4       if () else
  259.         cat <<EOF > %b
  260.         %iif () {
  261.         %i} else {
  262.         %i}
  263.         EOF
  264.  
  265. + f \.c$ | f \.cc$
  266. 5       if () else if ()
  267.         cat <<EOF > %b
  268.         %iif ( ) {
  269.         %i} else if ( ) {
  270.         %i}
  271.         EOF
  272.  
  273. + f \.c$ | f \.cc$
  274. 6       switch ()
  275.         NUMBER=%{ Enter number elements of switch:}
  276.         echo "%iswitch () {" >%b
  277.         while [ "$NUMBER" -gt 0 ]
  278.         do
  279.             echo "%icase '':" >>%b
  280.             echo "%i      break;" >>%b
  281.             let NUMBER=$NUMBER-1    
  282.         done
  283.         echo "%i      default:" >>%b
  284.         echo "%i}" >>%b
  285.         
  286. + f \.c$ | f \.cc$
  287. 7       for ()
  288.         cat <<EOF > %b
  289.         %ifor (i =  ; i <  ; i++) {
  290.         %i}
  291.         EOF
  292.         
  293. + f \.c$ | f \.cc$
  294. 8       while ()               
  295.         cat <<EOF > %b
  296.         %iwhile () {
  297.         %i}
  298.         EOF
  299.  
  300. + f \.c$ | f \.cc$
  301. 9       do {} while ()               
  302.         cat <<EOF > %b
  303.         %ido {
  304.         %i} while ()
  305.         EOF
  306.         
  307. + f \.c$ | f \.cc$
  308. a       array
  309.         cat <<EOF > %b
  310.         %ichar const x[] = {
  311.         %i, ,
  312.         %i};
  313.         EOF
  314.         
  315. + f \.c$ | f \.cc$
  316. b       enum
  317.         cat <<EOF > %b
  318.         %ienum x {
  319.         %i, ,
  320.         %i};
  321.         EOF
  322.         
  323. + f \.c$ | f \.cc$
  324. c       struct
  325.         cat <<EOF > %b
  326.         %istruct ? {
  327.         %i;
  328.         %i};
  329.         EOF
  330.         
  331. + f \.c$ | f \.cc$
  332. d       union
  333.         cat <<EOF > %b
  334.         %iunion ? {
  335.         %i;
  336.         %i};
  337.         EOF
  338.         
  339. + f \.c$ | f \.cc$
  340. e       typedef struct
  341.         cat <<EOF > %b
  342.         %itypedef struct {
  343.         %i;
  344.         %i} ?;
  345.         EOF
  346.  
  347. + f \.c$ | f \.cc$
  348. f       function
  349.         NAME=%{ Enter name of function:}
  350.         cat <<EOF >> %b
  351.         $NAME()
  352.         {
  353.         } /* end of $NAME() */
  354.         EOF
  355.  
  356. + f \.c$ | f \.h$ | f \.cc$
  357. g       #include
  358.         INC=%{ Enter include name: }
  359.         if [ -r "$INC" ];then
  360.             echo \#include \"$INC\" >%b
  361.         else
  362.             echo \#include \<$INC\> >%b
  363.         fi
  364.  
  365. + f \.c$ | f \.h$ | f \.cc$
  366. d       #define
  367.         echo "#define " >%b
  368.  
  369. + f \.c$ | f \.h$ | f \.cc$
  370. d       #ifdef
  371.         cat <<EOF > %b
  372.         #ifdef
  373.         #else
  374.         #endif
  375.         EOF
  376.  
  377. + f \.c$ | f \.h$ | f \.cc$
  378. ...............................................................................
  379.  
  380. + f \.c$ | f \.h$ | f \.cc$
  381. h       View all *.h into current directory
  382.     cat *.h |less
  383.  
  384. + f \.c$ | f \.cc$
  385. d       Run gdb for current file
  386.         [ -x "./%n" ] && gdb ./%n
  387.  
  388. = f \.c$ | f \.cc$
  389. + f \.c$ | f \.cc$
  390. c       Compile, link and run the current .c file
  391.         export CFLAGS="-g -Wall -O2"
  392.         make || make %n || cc $CFLAGS -o %n %f
  393.         [ -r "%n" ] && (echo "*** press any key for run... ***"; read)
  394.         [ -x "%n" ] && ./%n
  395.         (echo -ne "\n--- Press any key for return to edit. ---"; read)
  396.  
  397. + f \.c$ | f \.h$
  398. t       Indent `C' formatter
  399.     indent -kr -pcs %b 1>/dev/null 2> %e
  400.  
  401. #--------------------- End [c/c++] language template --------------------------
  402.  
  403. #------------------------- Begin unknown template -----------------------------
  404. + y unknown & t r
  405. s       #!/bin/sh
  406.         echo "#!/bin/sh" >%b
  407.  
  408. + y unknown & t r
  409. p       #!/usr/bin/perl
  410.         echo "#!/usr/bin/perl" >%b
  411.  
  412. + y unknown & t r
  413. a       Author description header
  414.         unset LANG
  415.         AUTHOR="$(cat /etc/passwd |grep ^$(id -un) |awk -F: '{print($5)}')"
  416.         cat >>%b <<EOF
  417.         ----------------------------------------------------------------------
  418.         Description:
  419.         Author: $AUTHOR <$(echo -ne $REPLYTO)>
  420.         Created at: $(date)
  421.         Computer: $(uname -n) 
  422.         System: $(uname -sr) on $(uname -m)
  423.         
  424.         Copyright (c) $(date +%%Y) $AUTHOR  All rights reserved.
  425.         ----------------------------------------------------------------------
  426.                 
  427.         EOF
  428. #--------------------------- End unknown template -----------------------------
  429.  
  430. -------------------------------------------------------------------------------
  431.  
  432. #----------------------- Begin common section ---------------------------------
  433. I       Insert `Changelog' string
  434.         DATE=$(date +%%Y-%%m-%%d)
  435.         AUTHOR="$(cat /etc/passwd |grep ^$(id -un) |awk -F: '{print($5)}')"
  436.         EMAIL="<$(echo -ne $REPLYTO)>"
  437.         echo "$DATE  $AUTHOR  $EMAIL" >%b
  438.  
  439. s       Invoke `shell'
  440.     sh
  441.  
  442. m       view `man'
  443.         MAN=%{Enter name of man:}
  444.         TMPFILE=/tmp/mcview.$MAN.$$
  445.         man -Pcat $MAN >$TMPFILE
  446.         mcview $TMPFILE
  447.         rm -f $TMPFILE
  448.                 
  449. i       Insert a out of command to cursor.
  450.         CMD=%{ Enter command: }
  451.         eval $CMD > %b
  452.  
  453. o       Open bash to next free console
  454.         open -s -- /bin/bash
  455. #-------------------------- End of common section -----------------------------
  456.